package com.yukefms.engine.senario;

import com.yukefms.rule.TriggerResponseBARule;
import com.yukefms.rule.formula.basis.InParallelFormula;
import com.yukefms.rule.interfaces.BARule;
import com.yukefms.rule.interfaces.BAStageRule;

/**
 * @Description
 * @Author Ping
 * @Date 2021/7/8 12:48
 **/
public class TwoSegmentsInLineSenario implements Senario {


    @Override
    public BAStageRule buildRule(String ruleName) {
        TriggerResponseBARule.TriggerResponseRuleBuilder ruleBuilder = TriggerResponseBARule.builder() ;

        BAStageRule rule = ruleBuilder.setTrigger(
                /**
                 * First, two shoulders and two elbows should in parallel
                 */
                new InParallelFormula("6", "10","4", "8"))
                .setResponse(new InParallelFormula("4","5","8","9"))
                /**
                 * Then, moving two hands to the extent that, the shoulder and elbow should keep in horizonal line.
                 */
//                                                        .add(new InLineFormula("5","4","8"))
//                                                        .add(new InLineFormula("4","8","9")))
                /**
                 * During moving, shouders and elbows shoud in parallel.
                 */
                .setInvariant(new InParallelFormula("6", "10","4", "8"))
                .setRuleName(ruleName)
                .build() ;
        return rule;
    }
}
